package cn.qicaiwang.open.system.mapper;

import cn.qicaiwang.open.system.model.entity.SystemMenu;
import cn.qicaiwang.open.system.model.req.SystemMenuREQ;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * SystemMenuMapper继承基类
 */
public interface SystemMenuMapper extends BaseMapper<SystemMenu> {
    List<SystemMenu> selectListByUserId(String id);

    Page<SystemMenu> page(Page page, SystemMenuREQ params);

    List<SystemMenu> selectListByRolePerm(String rolePerm);

    @Select("select * from system_menu where del_flag = 1")
    Page<SystemMenu> recyclebin(Page page);
    @Update("update system_menu set del_flag = 0 where id = #{id}")
    int restore(String id);

    @Delete("delete from system_menu where del_flag = 1")
    int clear();
}